package com.jzo2o.foundations.controller.consumer;


import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
import com.jzo2o.foundations.model.dto.response.ServeAggregationTypeSimpleResDTO;
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
import com.jzo2o.foundations.model.dto.response.ServeSimpleResDTO;
import com.jzo2o.foundations.service.IServeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


//firstPageServeList
@RestController("consumerServeController")
@RequestMapping("/customer/serve")
@Api(tags = "小程序端 -相关接口")
public class ServeController {

    @Autowired
    private IServeService  serveService;
    @GetMapping("/firstPageServeList")
    @ApiOperation("查询首页服务列表")
    public List<ServeCategoryResDTO> firstPageServeList(Long regionId) {
        return serveService.firstPageServeList(regionId);
    }

    @GetMapping("/hotServeList")
    @ApiOperation("查询热门服务列表")
    public List<ServeAggregationSimpleResDTO> hotServeList(Long regionId) {
        return serveService.hotServeList(regionId);
    }

    @GetMapping("/{id}")
    @ApiOperation("查询服务详情")
    public ServeAggregationSimpleResDTO findById(@PathVariable("id") Long id) {
        return serveService.findById(id);
    }

    //GET  /foundations/customer/serve/serveTypeList
    @GetMapping("/serveTypeList")
    @ApiOperation("查询全部服务")
    public List<ServeAggregationTypeSimpleResDTO> serveTypeList(Long regionId) {
        return serveService.serveTypeList(regionId);
    }
    @GetMapping("/search")
    @ApiOperation("服务搜索")
    public List<ServeSimpleResDTO> search(String cityCode, String keyword, Long serveTypeId) {
        return serveService.search(cityCode, keyword, serveTypeId);
    }

}
